package com.learn.project2.service.admin.dashboard;

import com.learn.project2.mapper.admin.dashboard.DashboardMapper;
import com.learn.project2.model.vo.admin.dashboard.DashboardVO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
//@CacheConfig(cacheNames = "marketDashboard")
public class DashboardServiceImpl implements DashboardService {

    @Autowired
    DashboardMapper dashboardMapper;
    @Override
    //@Cacheable
    public DashboardVO selectDashboard() {

        DashboardVO dashboardVO = new DashboardVO();
        Integer goodsTotal = dashboardMapper.selectGoods();
        dashboardVO.setGoodsTotal(goodsTotal);
        Integer productTotal = dashboardMapper.selectProduct();
        dashboardVO.setProductTotal(productTotal);
        Integer userTotal = dashboardMapper.selectUser();
        dashboardVO.setUserTotal(userTotal);
        Integer orderTotal = dashboardMapper.selectOrder();
        dashboardVO.setOrderTotal(orderTotal);
        return dashboardVO;
    }
}
